package re56.equipment;

import java.util.Random;

import re56.layer.MACLayer;
import re56.layer.PhysicalLayer;
import re56.layer.RadioLayer;
import re56.misc.Vector2;
import re56.packet.Packet;

public class Equipment
{
	protected Vector2 position;
	protected MACLayer Mac;
	protected PhysicalLayer Phy;
	protected Random rand = new Random();
	
	public Equipment(RadioLayer radioLayerDL, RadioLayer radioLayerUL)
	{
		// create my own MAC Interface
		Mac = new MACLayer(this);
		
		// generate a random position (in meters) between (0,0) and (999,999)
		position = new Vector2(rand.nextInt(1000), rand.nextInt(1000));
	}
	
	public String getMACAddress()
	{
		return Mac.getStringMACAddress();
	}
	
	public MACLayer getMacLayer()
	{
		return Mac;
	}
	
	public PhysicalLayer getPhysicalLayer()
	{
		return Phy;
	}
	
	public void receive(Packet p)
	{
		
	}
	
	public void send(Packet p, Equipment e)
	{
		Mac.sendPacket(p, e);
	}

	public void setPosition(Vector2 position)
	{
		this.position = position;
	}

	public Vector2 getPosition()
	{
		return position;
	}
}
